<template>
  <div class="bus-child1">
    <h3>BusChild1 组件</h3>
    <p>这个组件会监听来自 BusChild2 的事件，并显示接收到的消息。</p>
    <button @click="sendMessage">发送消息到 BusChild2</button>
  </div>
</template>

<script setup lang="ts">
import { getCurrentInstance } from 'vue'

const instance = getCurrentInstance()
function sendMessage() {
  instance?.proxy?.$bus.emit('message-from-child1', 'Hello from BusChild1')
}
</script>

<style scoped lang="scss"></style>
